var CheckTypeDialog = function () {
  var template = /*html*/ `
    <div class="check-type-dialog">
      <div style="margin-bottom:15px">检验类型</div>
      <div style="margin-bottom:20px">
        <el-input style="width:100%" size="medium" v-model="inputValue" placeholder="请输入检验类型"></el-input>
      </div>
      <div style="text-align:center">
        <el-button size="medium" type="primary" @click="ensure">
          <span v-if="type==='add'">新增</span>
          <span v-else>修改</span>
        </el-button>
      </div>
    </div>
  `;

  return {
    props: {
      type: {
        type: String,
        default: 'add'
      },
      initValue: {
        type: String,
        default: ''
      }
    },

    data: function () {
      return {
        inputValue: this.initValue
      };
    },

    methods: {
      ensure: function () {
        var inputValue = this.inputValue.trim();
        if (inputValue === '') {
          this.$alert('请输入检验类型', '信息');
          return;
        }

        this.$emit('submit', inputValue, this.type);
      }
    },

    template: template
  };
}();
